<extend name="Public/base" />
<block name="style">
    <style>
        input{
            font-size: xx-small;
        }
        @-webkit-keyframes icon-spin {
            0% {
                -webkit-transform: rotateZ(0deg);
            }
            100% {
                -webkit-transform: rotateZ(360deg);
            }
        }
        .transform{
            -webkit-animation: icon-spin 2s infinite linear;
            animation: icon-spin 2s infinite linear;
        }

    </style>
</block>
<block name="body">
    <div ng-controller="CaigouerCtrl" ng-cloak  class="ng-cloak" ng-init="assoinit('{$batch}')">
        <form method="POST" id="list">
        <!-- 标题栏 -->
        <div class="main-title">
            <h2>{$title}</h2>
        </div>
        </form>
        <div class="cf">
            <div class="search-form fr cf">
                <div class="sleft">
                    <span class="btn btn-primary" ng-click="validDataVerify()">校验</span>
                </div>
                <div class="sleft">
                    <input type="text" ng-model="loss" max=1 ng-change="lossChange()" class="input-3x form-control" placeholder="损耗[小数<1]">
                </div>
                <div class="sleft">
                    <input type="text" ng-model="trans_fee" ng-change="transFeeChange()" class="input-3x form-control" placeholder="运费">
                </div>
            </div>
        </div>
        <!-- 数据列表 -->
        <form action="{:U('Caigouer/predingjia')}" method="post" class="form-horizontal">
            <div class="data-table table-striped" style="font-size: smaller">
                <table id="inventoryTable">
                        <thead>
                            <tr>
                                <th colspan="2">校验</th>
                                <th>编号</th>
                                <th>商品[规格]</th>
                                <th>ERP商品<span style="margin-left: 10px;" ng-click="refreshProductList()" ng-class="{true:'transform',false:''}[refreshing]" class="glyphicon glyphicon-refresh" id="refreshbtn" title="点击刷新"></span></th>
                                <th>总件</th>
                                <th>单箱价</th>
                                <th>总重</th>
                                <th>单斤价</th>
                                <th>单箱费</th>
                                <th>单皮重</th>
                                <th>损耗</th>
                                <th>运费</th>
                                <th>食用率</th>
                                <th>优惠(元)</th>
                                <th>备注</th>
                                <!--<th>操作</th>-->
                            </tr>
                        </thead>
                        <tbody>
                            <tr ng-repeat="goods in batchgoods">
                                <td>
                                    <span class="glyphicon glyphicon-level-up text-primary" style="font-size: 18px;" title="快速存储" ng-click="quicksave($index)"></span>
                                </td>
                                <td ng-show="goods.valid">
                                    <span class="text-success glyphicon glyphicon-ok"  title="{{goods.help}}"></span>
                                    <span ng-show="goods.warn" class="text-warning glyphicon glyphicon-info-sign" title="{{goods.warn_info}}"></span>
                                </td>
                                <td ng-show="!goods.valid"><span class="text-danger glyphicon glyphicon-remove" title="{{goods.help}}"></span></td>
                                <td>
                                    {{goods.id}}
                                    <input type="text" class="hide" name="id[]" ng-model="goods.id">
                                </td>
                                <td style="width: 100px;">
                                    <!--采购商品规格-->
                                    <a href="{:U('material/addproduct')}&spec={{goods.spec|getSpecUnitWithNum}}/箱" class="clickzip" target="_blank"><span class="glyphicon glyphicon-share-alt" title="快速创建"></span></a>
                                    {{goods.pname}}[{{goods.spec}}]
                                    <input type="text" class="hide" name="pname[]" ng-model="goods.pname">
                                    <input type="text" class="hide" name="spec[]" ng-model="goods.spec">
                                    <input type="text" class="hide" name="batch[]" ng-model="goods.batch">
                                </td>
                                <td>
                                    <select select2  ng-change="proselect($index,proindex)"  class="input-3x" ng-model="proindex">
                                        <option></option>
                                        <option ng-repeat="pro in productlist" value="{{($index)}}">{{pro.pname}}[{{pro.spec}}]</option>
                                    </select>
                                    <input type="text" class="hide" name="BIN[]" ng-model="goods.BIN">
                                    <input type="text" class="hide" name="erp_pname[]" ng-model="goods.erp_pname">
                                    <input type="text" class="hide" name="erp_spec[]" ng-model="goods.erp_spec">
                                    <input type="text" class="hide" name="type_json[]" ng-model="goods.type_json">
                                </td>
                                <td>
                                    <!--总箱数-->
                                    <input type="tel" name="total_num[]" ng-model="goods.total_num" class="form-control input-x">
                                </td>
                                <td>
                                    <!--单箱价格-->
                                    <input type="tel" name="unit_num_price[]" ng-model="goods.unit_num_price" class="form-control input-x">
                                </td>
                                <td>
                                    <!--总重-->
                                    <input type="tel" name="total_weight[]" ng-model="goods.total_weight" class="form-control input-2x">
                                </td>
                                <td>
                                    <!--每斤价格-->
                                    <input type="text" name="unit_weight_price[]" ng-model="goods.unit_weight_price" class="form-control input-x">
                                </td>
                                <td>
                                    <!--单箱箱费-->
                                    <input type="text" name="unit_box_fee[]" ng-model="goods.unit_box_fee" class="form-control input-x">
                                </td>
                                <td>
                                    <!--单箱皮重-->
                                    <input type="text" name="unit_box_weight[]" ng-model="goods.unit_box_weight" class="form-control input-x">
                                </td>
                                <td>
                                    <!--损耗-->
                                    <input type="text" name="loss[]" ng-model="goods.loss" class="form-control input-x">
                                </td>
                                <td>
                                    <!--单箱运费-->
                                    <input type="text" name="trans_fee[]" ng-model="goods.trans_fee" class="form-control input-x">
                                </td>
                                <td>
                                    <!--食用率-->
                                    <input type="text" name="percent[]" ng-model="goods.percent" class="form-control input-x">
                                </td>
                                <td>
                                    <!--优惠金额-->
                                    <input type="tel" name="cost_off[]" ng-model="goods.cost_off" class="form-control input-x">
                                </td>
                                <td>{{goods.remark}}</td>
                            </tr>
                            <tr>
                                <td colspan="5">
                                    <input type="submit" ng-class="{true:'',false:'disabled'}[isVaild]"  class="  btn btn-primary" value="提交处理结果">
                                </td>
                            </tr>
                        </tbody>
                </table>
            </div>
        </form>
        <div class="page">
            {$_page}
        </div>
    </div>
</block>

<block name="script">
    <script type="text/javascript" src="__JS__/caigouer.js"></script>
    <script src="__STATIC__/thinkbox/jquery.thinkbox.js"></script>
    <script type="text/javascript">
        //导航高亮
    highlight_subnav('{:U('Inventory/warn')}');
    </script>
</block>
